<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<title>企业已申报药品澄清审核</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>药品澄清审核</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">药品招标管理</a></li>
            <li class="active"><a href="#">投标药品信息管理</a></li>
            <li class="active"><a href="#">药品澄清审核</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                	<div class="form-group form-group-xs">
                	    <label for="txtDrugName">项目名称：</label>
					    <select class="form-control" style="width:220px;" id="projId" name="projId"></select>
                	</div>
                    <div class="form-group form-group-xs">
                     <label>药品编码：</label>
                        <input class="form-control" type="text" id="drugCode" placeholder="药品编码" />
                    </div>
                     <div class="form-group form-group-xs">
                        <label>通用名：</label>
                        <input class="form-control" type="text" id="qualityspecName" placeholder="通用名" />
                    </div>
                    <button type="button" class="btn btn-success btn-sm" onclick="search()">查&nbsp;询</button>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <!-- <div class=" box box-warning bottongroup">
        	<label class="btn btn-default btn-sm" onclick="batchChangeStatusAudit()">通 过</label>
        	<label class="btn btn-default btn-sm" onclick="batchChangeStatusAuditNot()">不通过</label>
        </div> -->
      <div class="modal fade" id="dialog" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header bg-primary">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h5 class="modal-title">澄清备注<span id="editTitle">澄清备注</span></h5>
						<input type="hidden" id="projProddrugId" name="projProddrugId" value="">
					</div>
					<div class="modal-body">
						<div class="form-group form-group-xs">
							<label for="pharCode" class=" control-label">澄清备注:</label>
							<input type="text" class="form-control" id="complainAuditRemark" placeholder="澄清备注" maxlength="512">
						</div>
					</div>
					<div class="modal-footer">
						<label class="btn btn-primary btn-sm" onclick="batchChangeStatusAudit()">通&nbsp;过</label>
        				<label class="btn btn-danger btn-sm" onclick="batchChangeStatusAuditNot()">不通过</label>
					</div>
				</div>
			</div>
		</div>
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    $(function(){
		$("#projId").HNSelect({
            url: "${pageContext.request.contextPath}/selectController/getDicBidCompany.html", data: { ID: '' }, defaultText: "<option value=''>请选择</option>",
        });
	});
    
    
    //查询
	function search() {
    	var projId = $("#projId").val();
		var qualityspecName = $("#qualityspecName").val();
		$("#gridlist").jqGrid("clearGridData");
			$("#gridlist").jqGrid('setGridParam',{  
			url:"${ctx}/bidProject/getDeclareDrugDataList.html",
			mtype: "POST",
	        datatype:'json',
	        postData:{
	        	"projId":projId,
	        	"qualityspecName":qualityspecName},
	        page : 1
	    }).trigger("reloadGrid"); //重新载入  
	}
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/bidProject/getDeclareDrugDataList.html?complainStatus=0&auditType=0",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                shrinkToFit:false,
                height: 270,
                colNames: ['操作','projProddrugId','企业ID','projId','项目名称','药品编码','通用名','剂型','规格','转换系数','单位','材质','企业编码','企业名称','组织机构代码','企业地区','审核状态','澄清状态'],
                colModel: [
                       	{ name: 'opeats', width: 80, align:"center", sortable:false,
    						formatter : function(val, opts, rowdata) {
    							var str="";
    							 str =  "<a href='javascript:toedit(\""+rowdata.projProddrugId+"\");' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat 0px -40px' class='opIcon' title='澄清审核'></a>";
    							return str;
    						}},
					{ name: 'projProddrugId', width: 100,hidden:true , align:"center" ,sortable: false},
					{ name: 'compId', width: 100,hidden:true , align:"center" ,sortable: false},
					{ name: 'projId', width: 120 , hidden:true , align:"center",sortable: false},
					{ name: 'name', width: 180 , align:"center",sortable: false},
					{ name: 'drugCode', width: 120 , align:"center" ,sortable: false},
					{ name: 'qualityspecName', width: 140 , align:"center" ,sortable: false},
					{ name: 'formName', width: 100 , align:"center" ,sortable: false},
					{ name: 'specName', width: 100 , align:"center" ,sortable: false},
					{ name: 'factor', width: 80 , align:"center" ,sortable: false},
					{ name: 'unit', width: 80 , align:"center" ,sortable: false},
					{ name: 'materialName', width: 80 , align:"center" ,sortable: false},
					{ name: 'compCode', width: 100 ,hidden:true , align:"center" ,sortable: false},
                    { name: 'compName', width: 180 , align:"center" ,sortable: false,
                    	formatter:function(cellvalue, options, row){ 
                    		return "<a href=\"javascript:$.HN.dialog.opendialog('"+cellvalue+"','企业详情','${ctx}/stdCompinfo/toStdCompinfoDetailJsp.html?compCodeDetail="+row.compCode+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>"
                    }},
                    { name: 'orgCode', width: 120 ,hidden:true , align:"center" ,sortable: false},
					{ name: 'areaName', width: 100 , align:"center" ,sortable: false},
					{ name: 'auditStatus', width: 100 , align:"center" ,sortable: false,
						formatter:function(val,opts,rowdata){
							var str="";
							if(val=="0"){
								return str="提交";
							}else if(val=="1"){
								return str="审核通过";
							}else if(val=="2"){
								return str="审核不通过";
							}
							return str;
						}},
					{ name: 'complainStatus', width: 100 , align:"center" ,sortable: false,
							formatter:function(val,opts,rowdata){
								var str="";
								if(val=="0"){
									return str="提交";
								}else if(val=="1"){
									return str="澄清通过";
								}else if(val=="2"){
									return str="澄清不通过";
								}else if(val=="3"){
									return str="未提交";
								}
								return str;
					}}
				
                ],
                
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: true, 
                viewrecords: true,
                caption: "澄清药品列表",
                jsonReader: {
                    repeatitems: false,
                    id: "projProddrugId"
                },
                loadComplete: function (data) { //完成服务器请求后，回调函数
                	var projId = data.form;
                	if(projId!=null && projId!=""){
                	$("#projId").find("option").each(function(){
                			if($.trim($(this).val()) == $.trim(projId)){
                    			$(this).attr("selected",true).parents("#projId").attr("disabled","disabled");
                    			$("#status").find("option[value='1']").attr("selected",true).parents("#status").attr("disabled","disabled");
                    			return;
                    		}
                	 }); 
                  }
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });

        //澄清通过
        function batchChangeStatusAudit(complainStatus) {
        	var complainAuditRemark = $("#complainAuditRemark").val();
        	var projProddrugId = $("#projProddrugId").val();
        	
    		
            $.HN.message.confirm("确定通过吗？", '', '').on(function (e) {
       		 if(e){
            var list = [];
                list.push({ "projProddrugId":projProddrugId});
                
            $.post("${ctx}/bidProject/auditComplainDrug.html", {
                "array" : json.jsonToString(list),"complainStatus":1,"complainAuditRemark":complainAuditRemark
            }, function(result) {
                if (result.success) {
                    $.HN.message.alert("操作成功！", "消息", "success");
                    document.location.href="${ctx}/bidProject/toDeclareDrugComplainAuditList.html?complainStatus=0";
                } else {
                    $.HN.message.alert("操作失败！", "消息", "error");
                }
            }, "json")
		      }
				 
			 });
        }
        //澄清不通过
        function batchChangeStatusAuditNot(complainStatus) {
        	var complainAuditRemark = $("#complainAuditRemark").val();
        	var  projProddrugId = $("#projProddrugId").val()
        	
            $.HN.message.confirm("确定不通过吗？", '', '').on(function (e) {
       		 if(e){
            var list = [];
                list.push({ "projProddrugId":projProddrugId});
           
            $.post("${ctx}/bidProject/auditComplainDrug.html", {
                "array" : json.jsonToString(list),"complainStatus":2,"complainAuditRemark":complainAuditRemark
            }, function(result) {
                if (result.success) {
                    $.HN.message.alert("操作成功！", "消息", "success");
                    document.location.href="${ctx}/bidProject/toDeclareDrugComplainAuditList.html?complainStatus=0";
                } else {
                    $.HN.message.alert("操作失败！", "消息", "error");
                }
            }, "json")
		      }
				 
			 });
        }
        
       
        
        function toedit(projProddrugId){
        	$('.modal-title').html('药品审核');
        	$('#projProddrugId').val(projProddrugId);
			$("#remark").val();
			$('#dialog').modal({
                keyboard: true
            });
        	
        }
        
       
    	
    </script>
</body>
</html>